package ceha;

import ceha.application.CEHALogin;
import ceha.util.OkCancelDialog;
import ceha.util.OkDialog;
import java.beans.Beans;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.RollbackException;
import javax.swing.JFileChooser;
import javax.swing.JPanel;

public class CEHAFicheCreation extends JPanel {

    private CEHALogin main;

    public CEHAFicheCreation() {
        initComponents();
        if (!Beans.isDesignTime()) {
            entityManager.getTransaction().begin();
        }
    }

    public CEHAFicheCreation(CEHALogin main) {
        this.main = main;
        initComponents();
        if (!Beans.isDesignTime()) {
            entityManager.getTransaction().begin();
        }
        masterScrollPane.setVisible(false);
    }

  
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("BDDCEHAPU").createEntityManager();
        query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT f FROM Fiche f");
        list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(query.getResultList());
        masterScrollPane = new javax.swing.JScrollPane();
        masterTable = new javax.swing.JTable();
        formulairePanel = new javax.swing.JPanel();
        cdeadminPanel = new javax.swing.JPanel();
        datecorrectionLabel = new javax.swing.JLabel();
        idcorrecteurLabel = new javax.swing.JLabel();
        idcorrecteurField = new javax.swing.JTextField();
        validerfiche = new javax.swing.JButton();
        jDateChooser5 = new com.toedter.calendar.JDateChooser();
        dataPanel = new javax.swing.JPanel();
        sourcecombo = new javax.swing.JComboBox();
        lienimageField = new javax.swing.JTextField();
        typedocumentLabel = new javax.swing.JLabel();
        typedocCombo = new javax.swing.JComboBox();
        fichierButton = new javax.swing.JButton();
        lienvignette = new javax.swing.JTextField();
        dateLabel = new javax.swing.JLabel();
        parcourirvignette = new javax.swing.JButton();
        resumeLabel = new javax.swing.JLabel();
        auteurField = new javax.swing.JTextField();
        imageButton = new javax.swing.JButton();
        lienimageLabel = new javax.swing.JLabel();
        lienfichierLabel = new javax.swing.JLabel();
        auteurLabel = new javax.swing.JLabel();
        datetexteLabel = new javax.swing.JLabel();
        imagefilenameLabel = new javax.swing.JLabel();
        jScrollPane = new javax.swing.JScrollPane();
        resumeArea1 = new javax.swing.JTextArea();
        dateChooser = new com.toedter.calendar.JDateChooser();
        titreLabel = new javax.swing.JLabel();
        sourceLabel = new javax.swing.JLabel();
        siecleCombo = new javax.swing.JComboBox();
        jScrollPaneB = new javax.swing.JScrollPane();
        titreField = new javax.swing.JTextArea();
        lienFichierField = new javax.swing.JTextField();
        jScrollPaneB1 = new javax.swing.JScrollPane();
        titreField1 = new javax.swing.JTextArea();
        historicPanel = new javax.swing.JPanel();
        dimensionLabel = new javax.swing.JLabel();
        localisationLabel = new javax.swing.JLabel();
        droitsreproLabel = new javax.swing.JLabel();
        datedonationLabel = new javax.swing.JLabel();
        fondLabel = new javax.swing.JLabel();
        fondField = new javax.swing.JTextField();
        localisationField = new javax.swing.JTextField();
        dimensionField = new javax.swing.JTextField();
        jDateChooser4 = new com.toedter.calendar.JDateChooser();
        droitsreproCombo = new javax.swing.JComboBox();
        CadreVignette = new javax.swing.JPanel();
        vignette = new javax.swing.JLabel();
        cdePanel = new javax.swing.JPanel();
        saveButton = new javax.swing.JButton();
        nouvelFicheButton = new javax.swing.JButton();
        refreshButton = new javax.swing.JButton();
        effacerButton = new javax.swing.JButton();

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${id}"));
        columnBinding.setColumnName("Id");
        columnBinding.setColumnClass(Integer.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${imagefilename}"));
        columnBinding.setColumnName("Imagefilename");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${source}"));
        columnBinding.setColumnName("Source");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${typedocument}"));
        columnBinding.setColumnName("Typedocument");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${titre}"));
        columnBinding.setColumnName("Titre");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${auteur}"));
        columnBinding.setColumnName("Auteur");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${date}"));
        columnBinding.setColumnName("Date");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${datetexte}"));
        columnBinding.setColumnName("Datetexte");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${resume}"));
        columnBinding.setColumnName("Resume");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${lienimage}"));
        columnBinding.setColumnName("Lienimage");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${lienfichier}"));
        columnBinding.setColumnName("Lienfichier");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${fond}"));
        columnBinding.setColumnName("Fond");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${dimension}"));
        columnBinding.setColumnName("Dimension");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${droitsrepro}"));
        columnBinding.setColumnName("Droitsrepro");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${localisation}"));
        columnBinding.setColumnName("Localisation");
        columnBinding.setColumnClass(String.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${datedonation}"));
        columnBinding.setColumnName("Datedonation");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${datecorrection}"));
        columnBinding.setColumnName("Datecorrection");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${idcorrecteur}"));
        columnBinding.setColumnName("Idcorrecteur");
        columnBinding.setColumnClass(Integer.class);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();

        masterScrollPane.setViewportView(masterTable);

        formulairePanel.setBackground(new java.awt.Color(102, 102, 102));

        cdeadminPanel.setBackground(new java.awt.Color(255, 255, 255));
        cdeadminPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Contrôle et validation", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 3, 14), new java.awt.Color(255, 0, 0))); // NOI18N

        datecorrectionLabel.setFont(new java.awt.Font("Tahoma", 0, 10));
        datecorrectionLabel.setText("Date de correction");

        idcorrecteurLabel.setFont(new java.awt.Font("Tahoma", 0, 10));
        idcorrecteurLabel.setText("Id Correcteur");

        validerfiche.setBackground(new java.awt.Color(255, 255, 255));
        validerfiche.setFont(new java.awt.Font("Times New Roman", 1, 12));
        validerfiche.setForeground(new java.awt.Color(255, 0, 0));
        validerfiche.setText("Valider");

        jDateChooser5.setDateFormatString("DD MM YYYY");

        javax.swing.GroupLayout cdeadminPanelLayout = new javax.swing.GroupLayout(cdeadminPanel);
        cdeadminPanel.setLayout(cdeadminPanelLayout);
        cdeadminPanelLayout.setHorizontalGroup(
            cdeadminPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(cdeadminPanelLayout.createSequentialGroup()
                .addGap(49, 49, 49)
                .addComponent(validerfiche, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(24, Short.MAX_VALUE))
            .addGroup(cdeadminPanelLayout.createSequentialGroup()
                .addComponent(idcorrecteurLabel)
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, cdeadminPanelLayout.createSequentialGroup()
                .addGroup(cdeadminPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jDateChooser5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE)
                    .addComponent(idcorrecteurField, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE))
                .addGap(28, 28, 28))
            .addGroup(cdeadminPanelLayout.createSequentialGroup()
                .addComponent(datecorrectionLabel)
                .addContainerGap())
        );
        cdeadminPanelLayout.setVerticalGroup(
            cdeadminPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, cdeadminPanelLayout.createSequentialGroup()
                .addContainerGap(31, Short.MAX_VALUE)
                .addComponent(datecorrectionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jDateChooser5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(idcorrecteurLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(idcorrecteurField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(validerfiche))
        );

        dataPanel.setBackground(new java.awt.Color(51, 51, 51));

        sourcecombo.setFont(new java.awt.Font("Verdana", 1, 12));
        sourcecombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Original", "Copie" }));

        lienimageField.setFont(new java.awt.Font("Tahoma", 0, 12));

        typedocumentLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        typedocumentLabel.setForeground(new java.awt.Color(255, 255, 255));
        typedocumentLabel.setText("Type de document");

        typedocCombo.setFont(new java.awt.Font("Verdana", 1, 12));
        typedocCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Affiche", "Album thématique", "Carte postale", "Imprimé", "Journal", "Livre", "Magazine / Revue", "Manuscrit papier", "Manuscrit Vélin", "Matériel archéologique", "Numismatique", "Objet", "Photographie", "Plan", "Tableau / Gravure", "Tapuscrit", "Témoignage audio", "Témoignage vidéo", "Autres" }));

        fichierButton.setFont(new java.awt.Font("Times New Roman", 3, 14));
        fichierButton.setText("parcourir");
        fichierButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fichierButtonparcourirFichierA(evt);
            }
        });

        lienvignette.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, org.jdesktop.beansbinding.ELProperty.create("${selectedElement.imagefilename}"), lienvignette, org.jdesktop.beansbinding.BeanProperty.create("text"));
        bindingGroup.addBinding(binding);

        dateLabel.setBackground(new java.awt.Color(153, 153, 153));
        dateLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        dateLabel.setForeground(new java.awt.Color(255, 255, 255));
        dateLabel.setText("Date ");

        parcourirvignette.setFont(new java.awt.Font("Times New Roman", 3, 14));
        parcourirvignette.setText("parcourir");
        parcourirvignette.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                parcourirvignetteparcourirVignetteA(evt);
            }
        });

        resumeLabel.setBackground(new java.awt.Color(153, 153, 153));
        resumeLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        resumeLabel.setForeground(new java.awt.Color(255, 255, 255));
        resumeLabel.setText("Resumé");

        auteurField.setFont(new java.awt.Font("Times New Roman", 1, 14));

        imageButton.setFont(new java.awt.Font("Times New Roman", 3, 14));
        imageButton.setText("parcourir");
        imageButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                imageButtonparcourirLienImageA(evt);
            }
        });

        lienimageLabel.setBackground(new java.awt.Color(153, 153, 153));
        lienimageLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        lienimageLabel.setForeground(new java.awt.Color(255, 255, 255));
        lienimageLabel.setText("Lien vers une image");

        lienfichierLabel.setBackground(new java.awt.Color(153, 153, 153));
        lienfichierLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        lienfichierLabel.setForeground(new java.awt.Color(255, 255, 255));
        lienfichierLabel.setText("Lien vers un fichier (PDF)");

        auteurLabel.setBackground(new java.awt.Color(153, 153, 153));
        auteurLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        auteurLabel.setForeground(new java.awt.Color(255, 255, 255));
        auteurLabel.setText("Auteur");

        datetexteLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        datetexteLabel.setForeground(new java.awt.Color(255, 255, 255));
        datetexteLabel.setText("Date (autres)");

        imagefilenameLabel.setBackground(new java.awt.Color(153, 153, 153));
        imagefilenameLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        imagefilenameLabel.setForeground(new java.awt.Color(255, 255, 255));
        imagefilenameLabel.setText("Vignette");

        resumeArea1.setBackground(new java.awt.Color(255, 255, 204));
        resumeArea1.setColumns(20);
        resumeArea1.setFont(new java.awt.Font("Times New Roman", 1, 12));
        resumeArea1.setLineWrap(true);
        resumeArea1.setRows(5);
        resumeArea1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
        resumeArea1.setDragEnabled(true);
        jScrollPane.setViewportView(resumeArea1);

        dateChooser.setDateFormatString("DD MM YYYY");
        dateChooser.setFont(new java.awt.Font("Verdana", 1, 12));

        titreLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        titreLabel.setForeground(new java.awt.Color(255, 255, 255));
        titreLabel.setText("Titre*");

        sourceLabel.setBackground(new java.awt.Color(153, 153, 153));
        sourceLabel.setFont(new java.awt.Font("Lucida Sans Typewriter", 1, 14));
        sourceLabel.setForeground(new java.awt.Color(255, 255, 255));
        sourceLabel.setText("Source");

        siecleCombo.setFont(new java.awt.Font("Verdana", 1, 12));
        siecleCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "XXème", "XIXème", "XVIIIème", "XVIIème" }));

        titreField.setBackground(new java.awt.Color(255, 255, 204));
        titreField.setColumns(20);
        titreField.setFont(new java.awt.Font("Times New Roman", 1, 14));
        titreField.setLineWrap(true);
        titreField.setRows(5);
        jScrollPaneB.setViewportView(titreField);

        titreField1.setBackground(new java.awt.Color(255, 255, 204));
        titreField1.setColumns(20);
        titreField1.setFont(new java.awt.Font("Times New Roman", 1, 14));
        titreField1.setLineWrap(true);
        titreField1.setRows(5);
        jScrollPaneB1.setViewportView(titreField1);

        historicPanel.setBackground(new java.awt.Color(153, 153, 153));
        historicPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 204, 0), 2, true), "historique du document", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 3, 14), new java.awt.Color(255, 255, 0))); // NOI18N

        dimensionLabel.setFont(new java.awt.Font("Lucida Sans", 1, 14));
        dimensionLabel.setText("Dimension");

        localisationLabel.setFont(new java.awt.Font("Lucida Sans", 1, 14));
        localisationLabel.setText("Localisation");

        droitsreproLabel.setFont(new java.awt.Font("Lucida Sans", 1, 14));
        droitsreproLabel.setText("Droits de reproduction");

        datedonationLabel.setFont(new java.awt.Font("Lucida Sans", 1, 14));
        datedonationLabel.setText("Date de donation");

        fondLabel.setFont(new java.awt.Font("Lucida Sans", 1, 14));
        fondLabel.setText("Fond");

        fondField.setFont(new java.awt.Font("Tahoma", 0, 12));

        localisationField.setFont(new java.awt.Font("Tahoma", 0, 12));

        dimensionField.setFont(new java.awt.Font("Tahoma", 0, 12));

        jDateChooser4.setDateFormatString("DD MM YYYY");

        droitsreproCombo.setFont(new java.awt.Font("Verdana", 1, 12));
        droitsreproCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Fonds propres CEHA (droits réservés)", "Dépôt (avec droits accordés au CEHA)", "Fonds extérieurs (demander autorisation)", "Inconnu (ne pas publier)" }));

        javax.swing.GroupLayout historicPanelLayout = new javax.swing.GroupLayout(historicPanel);
        historicPanel.setLayout(historicPanelLayout);
        historicPanelLayout.setHorizontalGroup(
            historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(historicPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(droitsreproLabel)
                    .addGroup(historicPanelLayout.createSequentialGroup()
                        .addGroup(historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(localisationLabel)
                            .addComponent(dimensionLabel))
                        .addGap(57, 57, 57)
                        .addGroup(historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(dimensionField, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)
                            .addComponent(localisationField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE)))
                    .addGroup(historicPanelLayout.createSequentialGroup()
                        .addGroup(historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(datedonationLabel)
                            .addComponent(fondLabel))
                        .addGap(18, 18, 18)
                        .addGroup(historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jDateChooser4, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(fondField, javax.swing.GroupLayout.PREFERRED_SIZE, 312, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(historicPanelLayout.createSequentialGroup()
                        .addGap(182, 182, 182)
                        .addComponent(droitsreproCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE))))
        );
        historicPanelLayout.setVerticalGroup(
            historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(historicPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(fondLabel)
                    .addComponent(fondField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(datedonationLabel)
                    .addComponent(jDateChooser4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addGroup(historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(droitsreproLabel)
                    .addComponent(droitsreproCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(localisationLabel)
                    .addComponent(localisationField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(historicPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(dimensionLabel)
                    .addComponent(dimensionField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout dataPanelLayout = new javax.swing.GroupLayout(dataPanel);
        dataPanel.setLayout(dataPanelLayout);
        dataPanelLayout.setHorizontalGroup(
            dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dataPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(historicPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, dataPanelLayout.createSequentialGroup()
                            .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(jScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, dataPanelLayout.createSequentialGroup()
                                    .addComponent(typedocumentLabel)
                                    .addGap(18, 18, 18)
                                    .addComponent(typedocCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, dataPanelLayout.createSequentialGroup()
                                    .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(titreLabel)
                                        .addComponent(imagefilenameLabel)
                                        .addComponent(sourceLabel)
                                        .addComponent(auteurLabel)
                                        .addComponent(dateLabel))
                                    .addGap(18, 18, 18)
                                    .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jScrollPaneB, javax.swing.GroupLayout.DEFAULT_SIZE, 403, Short.MAX_VALUE)
                                        .addGroup(dataPanelLayout.createSequentialGroup()
                                            .addGap(13, 13, 13)
                                            .addComponent(sourcecombo, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGroup(dataPanelLayout.createSequentialGroup()
                                            .addComponent(lienvignette, javax.swing.GroupLayout.PREFERRED_SIZE, 269, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(parcourirvignette))
                                        .addComponent(auteurField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 381, Short.MAX_VALUE)
                                        .addGroup(dataPanelLayout.createSequentialGroup()
                                            .addComponent(dateChooser, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(18, 18, 18)
                                            .addComponent(datetexteLabel)
                                            .addGap(18, 18, 18)
                                            .addComponent(siecleCombo, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                .addComponent(resumeLabel, javax.swing.GroupLayout.Alignment.LEADING))
                            .addGap(162, 162, 162))
                        .addGroup(dataPanelLayout.createSequentialGroup()
                            .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(lienimageField)
                                .addComponent(lienFichierField, javax.swing.GroupLayout.DEFAULT_SIZE, 317, Short.MAX_VALUE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(imageButton)
                                .addComponent(fichierButton))
                            .addGap(233, 233, 233)))
                    .addComponent(lienfichierLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lienimageLabel))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        dataPanelLayout.setVerticalGroup(
            dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(dataPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(imagefilenameLabel)
                    .addComponent(lienvignette, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(parcourirvignette, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(sourceLabel)
                    .addComponent(sourcecombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(typedocumentLabel)
                    .addComponent(typedocCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(titreLabel)
                    .addComponent(jScrollPaneB, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(dataPanelLayout.createSequentialGroup()
                        .addGap(0, 0, 0)
                        .addComponent(auteurLabel))
                    .addComponent(auteurField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(dateLabel)
                    .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(datetexteLabel)
                            .addComponent(siecleCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(dateChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(7, 7, 7)
                .addComponent(resumeLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(15, 15, 15)
                .addComponent(lienfichierLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lienFichierField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(fichierButton, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addComponent(lienimageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(dataPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lienimageField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(imageButton, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(historicPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(106, 106, 106))
        );

        CadreVignette.setBackground(new java.awt.Color(204, 204, 204));
        CadreVignette.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 1, true));

        vignette.setBackground(new java.awt.Color(255, 255, 255));
        vignette.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        vignette.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/fondlogoCEHA.jpg"))); // NOI18N
        vignette.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.BELOW_TOP, new java.awt.Font("Verdana", 3, 12), new java.awt.Color(0, 0, 0))); // NOI18N

        javax.swing.GroupLayout CadreVignetteLayout = new javax.swing.GroupLayout(CadreVignette);
        CadreVignette.setLayout(CadreVignetteLayout);
        CadreVignetteLayout.setHorizontalGroup(
            CadreVignetteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(CadreVignetteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(vignette)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        CadreVignetteLayout.setVerticalGroup(
            CadreVignetteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, CadreVignetteLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(vignette, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout formulairePanelLayout = new javax.swing.GroupLayout(formulairePanel);
        formulairePanel.setLayout(formulairePanelLayout);
        formulairePanelLayout.setHorizontalGroup(
            formulairePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(formulairePanelLayout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(dataPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 506, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(formulairePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(formulairePanelLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(CadreVignette, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(formulairePanelLayout.createSequentialGroup()
                        .addGap(42, 42, 42)
                        .addComponent(cdeadminPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        formulairePanelLayout.setVerticalGroup(
            formulairePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(formulairePanelLayout.createSequentialGroup()
                .addComponent(dataPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 637, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addGroup(formulairePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(CadreVignette, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 97, Short.MAX_VALUE)
                .addComponent(cdeadminPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(109, 109, 109))
        );

        cdePanel.setLayout(new java.awt.GridLayout(4, 1));

        saveButton.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(204, 0, 0), 5, true), "A Sauvegarder", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 14), new java.awt.Color(204, 0, 0))); // NOI18N
        saveButton.setRequestFocusEnabled(false);
        saveButton.setRolloverEnabled(false);
        saveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveButtonsaveFicheA(evt);
            }
        });
        cdePanel.add(saveButton);

        nouvelFicheButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/10.gif"))); // NOI18N
        nouvelFicheButton.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 153, 0), 5, true), "Nouvelle Fiche", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Arial", 1, 14), new java.awt.Color(0, 102, 51))); // NOI18N
        nouvelFicheButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nouvelFicheButtonnouvelFicheA(evt);
            }
        });
        cdePanel.add(nouvelFicheButton);

        refreshButton.setBackground(new java.awt.Color(255, 255, 255));
        refreshButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/refresh.jpg"))); // NOI18N
        refreshButton.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 5, true), "Rafraichir", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 14), new java.awt.Color(0, 0, 0))); // NOI18N
        refreshButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                refreshButtonrefreshA(evt);
            }
        });
        cdePanel.add(refreshButton);

        effacerButton.setBackground(new java.awt.Color(255, 255, 255));
        effacerButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/poubelle.jpg"))); // NOI18N
        effacerButton.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 5, true), "Effacer", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Arial", 1, 14), new java.awt.Color(0, 0, 0))); // NOI18N
        effacerButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                effacerButtondeleteFicheA(evt);
            }
        });
        cdePanel.add(effacerButton);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 956, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(11, 11, 11)
                    .addComponent(formulairePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(cdePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(11, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(281, 281, 281)
                    .addComponent(masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 394, Short.MAX_VALUE)
                    .addGap(281, 281, 281)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 676, Short.MAX_VALUE)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(6, 6, 6)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(11, 11, 11)
                            .addComponent(cdePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(formulairePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(324, Short.MAX_VALUE)
                    .addComponent(masterScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(277, 277, 277)))
        );

        bindingGroup.bind();
    }// </editor-fold>//GEN-END:initComponents

    private void fichierButtonparcourirFichierA(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fichierButtonparcourirFichierA

        JFileChooser chooser = new JFileChooser();
        int returnVal = chooser.showOpenDialog(this);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            lienFichierField.setText(chooser.getSelectedFile().getAbsolutePath());
        }
}//GEN-LAST:event_fichierButtonparcourirFichierA

    private void parcourirvignetteparcourirVignetteA(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_parcourirvignetteparcourirVignetteA

        String ressourceStrRef = main.getRepVignette();
        JFileChooser chooser = new JFileChooser();
        chooser.setCurrentDirectory(new File(ressourceStrRef));
        chooser.changeToParentDirectory();
        int returnVal = chooser.showOpenDialog(this);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            lienvignette.setText(chooser.getSelectedFile().getAbsolutePath());
            vignette.setIcon(new javax.swing.ImageIcon(chooser.getSelectedFile().getAbsolutePath()));

        }
}//GEN-LAST:event_parcourirvignetteparcourirVignetteA

    private void imageButtonparcourirLienImageA(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imageButtonparcourirLienImageA
        JFileChooser chooser = new JFileChooser();
        int returnVal = chooser.showOpenDialog(this);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            lienimageField.setText(chooser.getSelectedFile().getAbsolutePath());
        }
}//GEN-LAST:event_imageButtonparcourirLienImageA

    private void saveButtonsaveFicheA(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonsaveFicheA
        if (titreField.getText().equals("")) {

            new OkDialog("Titre obligatoire !").setVisible(true);
        } else {
            try {
                entityManager.getTransaction().commit();
                entityManager.getTransaction().begin();
            } catch (RollbackException rex) {
                rex.printStackTrace();
                entityManager.getTransaction().begin();
                List<ceha.Fiche> merged = new ArrayList<ceha.Fiche>(list.size());
                for (ceha.Fiche f : list) {
                    merged.add(entityManager.merge(f));
                }
                list.clear();
                list.addAll(merged);
            }

            lienvignette.setText("");
            vignette.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ceha/ressource/fondlogoCEHA.jpg")));
        }
}//GEN-LAST:event_saveButtonsaveFicheA

    private void ficheEnable(boolean b) {
        saveButton.setEnabled(b);
        refreshButton.setEnabled(b);
        effacerButton.setEnabled(b);
        lienvignette.setEnabled(b);
        parcourirvignette.setEnabled(b);
        sourcecombo.setEnabled(b);
        typedocCombo.setEnabled(b);
        titreField.setEnabled(b);
        auteurField.setEnabled(b);
        jDateChooser5.setEnabled(b);
        jDateChooser4.setEnabled(b);
        idcorrecteurField.setEnabled(b);
        siecleCombo.setEnabled(b);
        resumeArea1.setEnabled(b);
        lienimageField.setEnabled(b);
        lienFichierField.setEnabled(b);
        fichierButton.setEnabled(b);
        imageButton.setEnabled(b);
        fondField.setEnabled(b);
        dateChooser.setEnabled(b);
        droitsreproCombo.setEnabled(b);
        localisationField.setEnabled(b);
        dimensionField.setEnabled(b);
    }

    private void nouvelFicheButtonnouvelFicheA(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nouvelFicheButtonnouvelFicheA

        ficheEnable(true);
        ceha.Fiche f = new ceha.Fiche();
        entityManager.persist(f);
        list.add(f);
        int row = list.size() - 1;
        masterTable.setRowSelectionInterval(row, row);
        masterTable.scrollRectToVisible(masterTable.getCellRect(row, 0, true));
        nouvelFicheButton.setIcon(null);
}//GEN-LAST:event_nouvelFicheButtonnouvelFicheA

    private void refreshButtonrefreshA(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonrefreshA
        entityManager.getTransaction().rollback();
        entityManager.getTransaction().begin();
        java.util.Collection data = query.getResultList();
        for (Object entity : data) {
            entityManager.refresh(entity);
        }
        list.clear();
        list.addAll(data);
}//GEN-LAST:event_refreshButtonrefreshA

    private void effacerButtondeleteFicheA(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_effacerButtondeleteFicheA
//        new OkCancelDialog("Confirmez", this, true).setVisible(true);
        if (OkCancelDialog.RET_OK == 1) {
            ficheEnable(false);
            int[] selected = masterTable.getSelectedRows();
            List<ceha.Fiche> toRemove = new ArrayList<ceha.Fiche>(selected.length);


            for (int idx = 0; idx
                    < selected.length; idx++) {
                ceha.Fiche f = list.get(masterTable.convertRowIndexToModel(selected[idx]));
                toRemove.add(f);
                entityManager.remove(f);
            }
            list.removeAll(toRemove);
        }
}//GEN-LAST:event_effacerButtondeleteFicheA
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel CadreVignette;
    private javax.swing.JTextField auteurField;
    private javax.swing.JLabel auteurLabel;
    private javax.swing.JPanel cdePanel;
    private javax.swing.JPanel cdeadminPanel;
    private javax.swing.JPanel dataPanel;
    private com.toedter.calendar.JDateChooser dateChooser;
    private javax.swing.JLabel dateLabel;
    private javax.swing.JLabel datecorrectionLabel;
    private javax.swing.JLabel datedonationLabel;
    private javax.swing.JLabel datetexteLabel;
    private javax.swing.JTextField dimensionField;
    private javax.swing.JLabel dimensionLabel;
    private javax.swing.JComboBox droitsreproCombo;
    private javax.swing.JLabel droitsreproLabel;
    private javax.swing.JButton effacerButton;
    private javax.persistence.EntityManager entityManager;
    private javax.swing.JButton fichierButton;
    private javax.swing.JTextField fondField;
    private javax.swing.JLabel fondLabel;
    private javax.swing.JPanel formulairePanel;
    private javax.swing.JPanel historicPanel;
    private javax.swing.JTextField idcorrecteurField;
    private javax.swing.JLabel idcorrecteurLabel;
    private javax.swing.JButton imageButton;
    private javax.swing.JLabel imagefilenameLabel;
    private com.toedter.calendar.JDateChooser jDateChooser4;
    private com.toedter.calendar.JDateChooser jDateChooser5;
    private javax.swing.JScrollPane jScrollPane;
    private javax.swing.JScrollPane jScrollPaneB;
    private javax.swing.JScrollPane jScrollPaneB1;
    private javax.swing.JTextField lienFichierField;
    private javax.swing.JLabel lienfichierLabel;
    private javax.swing.JTextField lienimageField;
    private javax.swing.JLabel lienimageLabel;
    private javax.swing.JTextField lienvignette;
    private java.util.List<ceha.Fiche> list;
    private javax.swing.JTextField localisationField;
    private javax.swing.JLabel localisationLabel;
    private javax.swing.JScrollPane masterScrollPane;
    private javax.swing.JTable masterTable;
    private javax.swing.JButton nouvelFicheButton;
    private javax.swing.JButton parcourirvignette;
    private javax.persistence.Query query;
    private javax.swing.JButton refreshButton;
    private javax.swing.JTextArea resumeArea1;
    private javax.swing.JLabel resumeLabel;
    private javax.swing.JButton saveButton;
    private javax.swing.JComboBox siecleCombo;
    private javax.swing.JLabel sourceLabel;
    private javax.swing.JComboBox sourcecombo;
    private javax.swing.JTextArea titreField;
    private javax.swing.JTextArea titreField1;
    private javax.swing.JLabel titreLabel;
    private javax.swing.JComboBox typedocCombo;
    private javax.swing.JLabel typedocumentLabel;
    private javax.swing.JButton validerfiche;
    private javax.swing.JLabel vignette;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}
